import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CommonModule } from '@angular/common';
import { NavModule } from '../../framework/navigation/navigation.module';
import { ResearchComponent } from './research.component';
import { AuthGuard } from '../../guards/auth.guard';
import { TableModule } from '../../shared/components/table/table.module';

const routes: Routes = [
    {
        path: '',
        component: ResearchComponent,        
        children: [
             {
                path: '',
                redirectTo: 'risk',
                pathMatch: 'full'
            },
            {
                path: 'risk',
                loadChildren: './riskRating/researchRiskRating.module#ResearchRiskRatingModule',
                canActivate: [AuthGuard]
            },
            {
                path: 'globalcompact',
                loadChildren: './globalCompact/researchGlobalCompact.module#ResearchGlobalCompactModule',
                canActivate: [AuthGuard]
            },
            {
                path: 'productinvolvement',
                loadChildren: './productInvolvement/researchProductInvolvement.module#ResearchProductInvolvementModule',
                canActivate: [AuthGuard]
            },
            {
                path: 'esg',
                loadChildren: './esgRating/researchEsgRating.module#ResearchEsgRatingModule',
                canActivate: [AuthGuard]
            },
            {
                path: 'company',
                loadChildren: './company/company.module#CompanyModule',
                //data: { preload: true },
                canActivate: [AuthGuard]
            },
            {
                path: 'corporategovernance',
                loadChildren: './corporateGovernance/researchCorporateGovernance.module#ResearchCorporateGovernanceModule',
                //data: { preload: true },
                canActivate: [AuthGuard]
            },
            {
                path: 'controversies',
                loadChildren: './controversies/researchControversies.module#ResearchControversiesModule',
                //data: { preload: true },
                canActivate: [AuthGuard]
            },
            {
                path: 'sustainableproducts',
                loadChildren: './sustainableProducts/researchSustainableProducts.module#ResearchSustainableProductsModule',
                canActivate: [AuthGuard]
            }
        ]
    }    
];

/**
 * Research module
 * 
 * Author: Sorin Spiru
 * Date: 13.01.2018
 */
@NgModule({
    imports:[  
        CommonModule,
        NavModule,
        RouterModule.forChild(routes),
        TableModule
    ],
    declarations: [        
        ResearchComponent  
    ],
    exports:[
        RouterModule,
        ResearchComponent
    ]
})
export class ResearchModule {

 }
